// 备件基础数据
import axios from '@/api/fetch';
import SERVER from '@/api/server';

export const queryPartInfos = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/partInfos`, { params });

// 备件新增
export const addPartInfo = params => axios.put(`${SERVER.DMSCLOUD_PART}/basedata/partInfos`, params);

export const ModifyPartInfo = (params, id) => axios.post(`${SERVER.DMSCLOUD_PART}/basedata/partInfos/a?id=${id}`, params);

export const queryUnitCode = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/partInfos/partGroupCode`, { params });

export const queryModel = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/partInfos/partModel`, { params });

// 获取所有品牌
export const getBrandAll = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/basedata/vehicleProduct/brandsqueryall`, {});
// 获取包装单位
export const queryPackUnit = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/partInfos/partGroupCode`, {});
// 获取包装单位
export const partExport = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/partInfos/export`, { params });

// 查询替换件信息(partNo根据备件代码查询相关)
export const queryReplacePartList = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/partInfos/partReplace`, { params });
// 查询r3备件价格
export const queryR3PartPriceList = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/partInfos/getR3Info`, { params });
// 下载r3价格
export const downloadR3Price = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/partInfos/uploadR3Price`, { params });
// 更新r3价格
export const updateR3PartPriceList = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/partInfos/updateR3Price`, { params });
// 全量更新r3价格
export const updateR3PartPriceListAll = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/partInfos/updateR3PriceAll`, { params, timeout: 300000 });
// 查询所有套餐
export const queryAllSetMeal = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/partInfos/getPackageTc`, { params });
// 根据套餐id查询套餐下的备件
export const quryPartBySetMealId = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/partInfos/getPackageTcItem`, { params });
